﻿<p>
    This example shows how to visually format the data in presented by Telerik Grid for ASP.NET MVC. Currently visual formatting works 
    only in server binding mode.
</p>
<p>
    You can use the <strong>RowAction</strong> method to format the entire row. It is executed for every single row of the grid.
</p>
<pre class="prettyprint">
&lt;%= Html.Telerik().Grid(Model)
        .Name("Grid")
        <em>.RowAction(row =>
        {
            // "DataItem" is the Order object to which the current row is bound to
            if (row.DataItem.Freight > 10)
            {
                //Set the background of the entire row
                row.HtmlAttributes["style"] = "background:red;";
            }
        });</em>
%&gt;
</pre>
<p>
    You can also use the <strong>CellAction</strong> method to format a concrete cell only. It is executed for every single cell of the grid.
</p>
<pre class="prettyprint">
&lt;%= Html.Telerik().Grid(Model)
        .Name("Grid")
        <em>.CellAction(cell =>
        {
            if (cell.Column.Name == "Freight")
            {
                if (cell.DataItem.Freight > 10)
                {
                    //Set the background of this cell only
                    cell.HtmlAttributes["style"] = "background:red;";
                }
            }
        });</em>
%&gt;
</pre>
